package com.bxl.netty.rpc.server.register;

import java.util.concurrent.ConcurrentHashMap;

/**
 * <>
 *
 * @author baixl
 * @date 2021/2/25
 */
public class BeanRegister {
    private static ConcurrentHashMap<String, Object> mapping = new ConcurrentHashMap<String, Object>();
    
    public static <T> void register(Class<T> clazz,T bean){
        mapping.putIfAbsent(clazz.getName(),bean);
    }
    public static <T> T getBean(String name){
        return (T)mapping.get(name);
    }
}
